import { getData, postData, putData, deleteData } from '@/api/common/index';

const baseUserRechargeRecordInfo = '/api/user-recharge-record-info';

const UserRechargeRecordInfoUrl = {
	page: '/page',
	url: '',
};

export function getUserRechargeRecordInfoPage(
	params: any,
	pageNo: number | null | undefined,
	pageSize: number | null | undefined,
): Promise<any> {
	let url =
		baseUserRechargeRecordInfo +
		UserRechargeRecordInfoUrl.page +
		'?pageNum=' +
		(pageNo ? pageNo : 1) +
		'&pageSize=' +
		(pageSize ? pageSize : 10);
	return postData(url, params);
}

export function getUserRechargeRecordInfoDetail(id: number): Promise<any> {
	return getData(
		baseUserRechargeRecordInfo + UserRechargeRecordInfoUrl.url + '?id=' + id,
	);
}

export function deleteUserRechargeRecordInfo(ids: string): Promise<any> {
	return deleteData(
		baseUserRechargeRecordInfo + UserRechargeRecordInfoUrl.url + '?ids=' + ids,
	);
}

export function addOrEditUserRechargeRecordInfo(
	method: string,
	params: any,
): Promise<any> {
	if ('put' == method) {
		return putData(
			baseUserRechargeRecordInfo + UserRechargeRecordInfoUrl.url,
			params,
		);
	} else {
		return postData(
			baseUserRechargeRecordInfo + UserRechargeRecordInfoUrl.url,
			params,
		);
	}
}
